package com.tuyrt.windy.logic.dao

import com.google.gson.Gson
import com.tuyrt.windy.common.Settings
import com.tuyrt.windy.logic.model.Place

/**
 * Created by tuyrt7 on 2021/4/14.
 */
object PlaceDao {

    fun savePlace(place: Place) {
        Settings.place = Gson().toJson(place)
    }

    fun getPlace(): Place {
        val place = Settings.place
        return Gson().fromJson(place, Place::class.java)
    }

    fun isPlaceSaved() = Settings.place.isNotEmpty()
}